import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'

axios.defaults.baseURL = "http://127.0.0.1:5000"

Vue.prototype.axios = axios

Vue.use(Element)

axios.interceptors.response.use(function (resp) {
  if (resp.data.code == 403) {
    error(resp.data.msg)
    router.push("/")
  }
  return resp
}, function (error) {
  console.log(error)
})

function success(msg){
  this.$message({
    message: msg,
    type: 'success'
  })
}
function error(msg){
  Vue.prototype.$message.error(msg);
}
Vue.prototype.$success = success
Vue.prototype.$error = error

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


import NavigationBar from '../src/components/NavigationBar'
Vue.component('NavigationBar', NavigationBar)

import Reception from '../src/components/Reception'
Vue.component('Reception', Reception)
